<?php
/**
 *
 * @author Dang Thu Trang <trangdtdg@gmail.com>
 *
 */
class CMS_Upload extends CI_Upload {
  /**
   * Constructor
   *
   * @access  public
   */
  function __construct($props = array())
  {
    parent::__construct($props);
  }
  /**
   * (non-PHPdoc)
   * @see cicms/system/libraries/CI_Upload#_prep_filename($filename)
   */
  function _prep_filename($filename){
    if (strpos($filename, '.') === FALSE)
    {
      return $filename;
    }

    $parts    = explode('.', $filename);
    $ext    = array_pop($parts);
    $filename = array_shift($parts);

    foreach ($parts as $part)
    {
      if ($this->mimes_types(strtolower($part)) === FALSE)
      {
        $filename .= '.'.$part.'_';
      }
      else
      {
        $filename .= '.'.$part;
      }
    }

    // file name override, since the exact name is provided, no need to
    // run it through a $this->mimes check.
    if ($this->file_name != '')
    {
      $filename = $this->file_name;
    }

    $filename .= '.'.$ext;

    return $filename;
  }//_prep_filename

}
?>